import type { BasicColumn, FormSchema } from '/@/components/Table';
import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();

export const typeColumns: BasicColumn[] = [
  {
    title: t('routes.table.dictionaryManagement.dictionaryName'),
    dataIndex: 'typeName',
    width: 180,
  },
  {
    title: t('routes.table.dictionaryManagement.dictionaryType'),
    dataIndex: 'type',
    width: 150,
  },
  {
    title: t('routes.table.dictionaryManagement.status'),
    dataIndex: 'status',
    width: 100,
    slots: { customRender: 'status' },
  },
  {
    title: t('routes.table.dictionaryManagement.isCreateDirectory'),
    dataIndex: 'universal',
    width: 100,
    slots: { customRender: 'universal' },
  },
  {
    title: t('routes.table.dictionaryManagement.remark'),
    dataIndex: 'resourceDescription',
    width: 180,
  },
];

export const typeSearchFormSchema: FormSchema[] = [
  {
    label: t('routes.table.dictionaryManagement.dictionaryName'),
    field: 'name',
    component: 'Input',
    colProps: { span: 8 },
  },
  {
    label: t('routes.table.dictionaryManagement.status'),
    field: 'status',
    component: 'Select',
    colProps: { span: 8 },
    componentProps: {
      options: [
        {
          label: t('common.enabled'),
          value: true,
        },
        {
          label: t('common.disabled'),
          value: false,
        },
      ],
    },
  },
];

export const typeFormSchema: FormSchema[] = [
  {
    label: t('routes.table.dictionaryManagement.code'),
    field: 'id',
    show: false,
    component: 'Input',
  },
  {
    label: t('routes.table.dictionaryManagement.dictionaryName'),
    field: 'typeName',
    required: true,
    component: 'Input',
    defaultValue: '',
  },
  {
    label: t('routes.table.dictionaryManagement.dictionaryType'),
    field: 'type',
    required: true,
    component: 'Input',
    defaultValue: '',
  },
  {
    label: t('routes.table.dictionaryManagement.status'),
    field: 'status',
    component: 'Select',
    defaultValue: true,
    componentProps: {
      options: [
        {
          label: t('common.enabled'),
          value: true,
        },
        {
          label: t('common.disabled'),
          value: false,
        },
      ],
    },
  },
  {
    label: t('routes.table.dictionaryManagement.isCreateDirectory'),
    field: 'needfolder',
    component: 'Select',
    defaultValue: false,
    componentProps: {
      options: [
        {
          label: t('common.yes'),
          value: true,
        },
        {
          label: t('common.no'),
          value: false,
        },
      ],
    },
  },
  {
    label: t('routes.table.dictionaryManagement.remark'),
    field: 'resourceDescription',
    component: 'InputTextArea',
    defaultValue: '',
  },
];
